package com.adou.second.day10;

import java.util.Properties;
import java.util.Set;

/**
 * 
 * @author admin
 *
 */
public class PropertiesDemo {

	public static void main(String[] args) {
//		// 无泛型
		Properties properties = new Properties();
//		properties.put("name", "张三");
//		properties.put("name", "李四");
//		properties.put("name", "王五");
//		
//		Set<Object> propertiesSet = properties.keySet();
//		for (Object key : propertiesSet) {
//			Object val = properties.get(key);
//			System.out.println("key=" +key + ", val=" + val);
//		}
		
		properties.setProperty("name", "张三");
		properties.setProperty("name", "李四");
		System.out.println(properties.getProperty("name"));
		System.out.println(properties.getProperty("name2"));
		
		Set<String> names = properties.stringPropertyNames();
		for (String key : names) {
			String val = properties.getProperty(key);
			
			System.out.println("key=" +key + ", val=" + val);
		}
		
	}

}
